n=input().lower()
k=''
for i in n :
    if 97<=ord(i)<=122:
        pass
    else:
        i=' '
    k+=i
a=k.split()
b=[]
for j in range(len(a)):
    b.append((a[j],a.count(a[j])))
c=set(b)
d=dict(c)
f=max(d.values())
print(f)
g=[v for v,k in d.items() if k==f]
h=sorted(g)
for i in h:
    print(i)
